﻿public class Solution14
{


    public string LongestCommonPrefix(string[] strs)
    {

        for (int i = 0; i < strs[0].Length; i++)
        {
            char c = strs[0][i];
            for (int j = 1; j < strs.Length; j++)
            {

                // if(char==strs[j][i])//继续

                if (i == strs[j].Length || c != strs[j][i])



                    return strs[0].Substring(0, i);
            }


        }


    

       return  strs[0];//只有一个字符串，就是自己

    }
}

class Program14
{

    static void Main14(string[] args)
    {
        Solution14 solution = new Solution14();
        string[] strs = ["ab", "a"];
        solution.LongestCommonPrefix(strs);
    }
}